In [1]:
%pylab inline
In [2]:
import pandas as pd
In [3]:
mypath = 'Cell_types.xlsx'
xls = pd.read_excel(mypath)
In [4]:
xls.head()
Out[4]:
In [5]:
xls.InputR
Out[5]:
In [6]:
xls['Vrest'].mean()
Out[6]:
In [7]:
xls['Vrest'].unique() # get NumPy array
Out[7]:
Let's evaluate how much the membrane potential depends on Input resistance and membrane time constant and the sag ratio. We will create the following multivariate function:
$f(k;x) = k_0 + k_1x_1 + k_2x_2 + k_3x_3$
where k is a vector or parameters (contants) and x is a vector of independent variables (i.e x_1 is the input resistance x_2 is membrane time constant and x_3 the sag ratio)
In [8]:
x = xls[['InputR', 'SagRatio','mbTau']]
y = xls[['Vrest']]
In [9]:
# import standard regression models (sm)
import statsmodels.api as sm
In [10]:
X1 = sm.add_constant(x) # k0, k1, k2 and k3...
In [11]:
# get estimation
est = sm.OLS(y, X1).fit() # ordinary least square regression
In [12]:
est.summary()
Out[12]:
r_squared is not very large... but coef gives us the values of K0, K1, k2, and K3 to plug into the equation. Based on the std err InputResistance and mbTau are more important than SagRatio to determine the AP.
In [ ]: